WSGI.dir=public_html/
DATA.dir=data/
ROOT.dir=/

INSTALL_DATA.dir= ${HOME}/data/${PROJECT}-${RELEASE}/
INSTALL_WSGI.dir= ${HOME}/public_html/${PROJECT}-${RELEASE}/

WSGI_NAME_INSTALL=${PROJECT}-${RELEASE}

#CSS_DIR = ${HOME}/public_html/static/css/

TEMPD.dir=${PROJECT}/data/
TEMPP.dir=${PROJECT}/public_html/
TEMPR.dir=${PROJECT}/



FILE_MODE=ug+rwX,o+rX
DIR_MODE=ug+rwXs,o+rX

DB=sqlite3.db

USER=group1
SERVER=proisis.lero.ie

PROJECT=GroupOne
RELEASE=2.0

RELEASE_NAME=${PROJECT}.${RELEASE}

WSGI_NAME=django
WSGI.script=${WSGI_NAME}.wsgi

INSTALL=install --mode=${FILE_MODE}
INSTALL_F=chmod ${FILE_MODE}

TAR_EXCLUDE=--exclude='.svn' --exclude='.git' --exclude='*.tar.gz' --exclude='*.pyc' --exclude='*~'

what:
	@echo "PROJECT: " ${PROJECT} 
	@echo "RELEASE: " ${RELEASE}
	@echo "RELEASE_CANDIDATE: " ${RELEASE_CANDIDATE}
	@echo "RELEASE_NAME: " ${RELEASE_NAME}

build: 
	python ${DATA.dir}manage.py syncdb

test: build
	python ${DATA.dir}manage.py test

install: test
	make ${WSGI.script}	
	${INSTALL} -d ${INSTALL_DATA.dir}
	${INSTALL} -d ${INSTALL_WSGI.dir}
	cd data/; \
	cp -rf . ${INSTALL_DATA.dir}
	${INSTALL} ${WSGI.script} ${INSTALL_WSGI.dir}
	${INSTALL_F} ${INSTALL_WSGI.dir}${WSGI.script}
	${INSTALL} .htaccess ${INSTALL_WSGI.dir}.htaccess
	${INSTALL} ${DB} ${INSTALL_DATA.dir}${DB}	
	${INSTALL_F} ${INSTALL_DATA.dir}${DB}


%.wsgi: %.wsgi.tmpl
	sed -e s,'_DATA_DIR_',${INSTALL_DATA.dir}, $< > $@


dist:	
	make tar
	make upload

tar:
	tar cfvz ${RELEASE_NAME}.tar.gz ${TAR_EXCLUDE} .

upload:
	scp ${RELEASE_NAME}.tar.gz ${USER}@${SERVER}:

